<template>
  <div>
    <Header_h />
    <div class="sq_box_content">
      <bannerInfo :info="info" />
    </div>
    <div class="new_box">
      <div class="container">
        <div class="s_flex s_align_items_start">
          <leftMenu :menu="menu" :check="active" @checkItem="checkItem" />
          <section class="core_content_left core_content">
            <div
              class="
                leader_heads
                s_flex s_justify_content_between s_flex_column
              "
            >
              <div class="h_item_list_img">
                <div class="h_img_wap">
                  <img class="" :src="list.tpic" alt="" />
                </div>
              </div>
              <div class="right_info">
                <div
                  class="s_flex s_justify_content_between s_align_items_center"
                >
                  <div class="s_flex s_align_items_center">
                    <h3
                      class="
                        sq_tilte3
                        line_h_30
                        sq_tilte_color
                        content_spacing
                        ft_weight_800
                      "
                    >
                      {{ list.name }}
                    </h3>
                  </div>
                  <div
                    class="sq_content sq_sign_btn"
                    @click.stop="getUrl(list)"
                  >
                    联系团队
                  </div>
                </div>
                <div class="sq_content sq_content_color leader_box">
                  <p class="ft_weight_400 line_h_26">
                    <span class="tag_right">所属院校:</span
                    ><el-tag size="small" class="tag_right" effect="plain">{{
                      list.school
                    }}</el-tag>
                  </p>
                  <p class="ft_weight_400 line_h_26">
                    <span class="tag_right">科研领域:</span
                    ><el-tag size="small" class="tag_right" effect="plain">{{
                      list.realm
                    }}</el-tag>
                  </p>
                </div>
              </div>
            </div>
            <div class="leader_infos">
              <div class="leader_heads listshow1">
                <div class="sq_tilte_color ft_weight_800">
                  <div class="s_flex s_align_items_center">
                    <span class="r_line"></span>
                    <h3>详细简介：</h3>
                  </div>
                </div>
                <div
                  class="sq_html sq_content line_h_26 sq_content_color"
                  v-html="list.desc"
                ></div>
              </div>
              <div class="leader_heads listshow2">
                <div class="sq_tilte_color ft_weight_800">
                  <div class="s_flex s_align_items_center">
                    <span class="r_line"></span>
                    <h3>科研项目：</h3>
                  </div>
                </div>
                <div
                  class="sq_html sq_content line_h_26 sq_content_color"
                  v-html="list.project"
                ></div>
              </div>
              <div class="listshow3">
                <div
                  class="
                    sq_tilte_color
                    ft_weight_800
                    leader_heads
                    s_flex s_align_items_center s_justify_content_between
                  "
                >
                  <div class="s_flex s_align_items_center">
                    <span class="r_line"></span>
                    <h3>优秀专利</h3>
                  </div>
                  <div>
                    <el-select
                      v-model="value"
                      @change="handelChange"
                      placeholder="领域"
                      clearable
                      @clear="clearValue"
                    >
                      <el-option
                        v-for="item in options"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id"
                      >
                      </el-option>
                    </el-select>
                  </div>
                </div>
                <div class="sq_html">
                  <div
                    class="item_list leader_heads"
                    v-for="(item, index) in patent_list"
                    :key="index"
                  >
                    <div class="number">
                      <span class="cril"></span>#{{ index + 1 }}
                    </div>
                    <div class="s_flex s_justify_content_between s_flex_column">
                      <div class="item_list_img">
                        <div class="img_wap">
                          <img class="" :src="item.imgname" alt="" />
                        </div>
                      </div>
                      <div class="right_info">
                        <div
                          class="
                            s_flex
                            s_justify_content_between
                            s_align_items_center
                            s_flex-wrap
                          "
                        >
                          <div class="s_flex s_align_items_center">
                            <el-tag
                              size="small"
                              class="tag_right"
                              effect="plain"
                              >{{ item.realm }}</el-tag
                            >
                            <el-tag
                              size="small"
                              class="tag_right"
                              effect="plain"
                              >{{ item.school }}</el-tag
                            >
                            <el-tag
                              size="small"
                              class="tag_right"
                              effect="plain"
                              >{{ item.team }}</el-tag
                            >
                          </div>
                          <div
                            class="sq_content sq_sign_btn"
                            @click.stop="
                              $router.push({
                                path: '/detail',
                                query: { pid: item.pid },
                              })
                            "
                          >
                            对接专利
                          </div>
                        </div>
                        <div class="pantent s_flex s_align_items_center">
                          <p class="sq_title3" style="color: #2a8b2d">
                            {{ item.pno }}
                          </p>
                          <el-tag
                            v-if="item.status == '授权'"
                            effect="dark"
                            size="small"
                            color="#4ba22f"
                            >授权</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#4ba22f"
                            v-if="item.status == '部分无效'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#4ba22f"
                            v-if="item.status == '权利恢复'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#6c778b"
                            v-if="item.status == '未缴年费'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#6c778b"
                            v-if="item.status == '撤回'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#6c778b"
                            v-if="item.status == '驳回'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#6c778b"
                            v-if="item.status == '期限届满'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#6c778b"
                            v-if="item.status == '避重授权'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#6c778b"
                            v-if="item.status == '全部撤销'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#da7b21"
                            v-if="item.status == '实质审查'"
                            >{{ item.status }}</el-tag
                          >
                          <el-tag
                            effect="dark"
                            size="small"
                            color="#da7b21"
                            v-if="item.status == '公开'"
                            >{{ item.status }}</el-tag
                          >
                        </div>
                        <h3
                          class="
                            sq_tilte3
                            line_h_30
                            sq_tilte_color
                            content_spacing
                            ft_weight_400
                          "
                        >
                          {{ item.tic }}
                        </h3>
                        <div class="sq_content sq_content_color">
                          <p class="ft_weight_400 line_h_26">
                            公开（公告）日：{{ item.pd }}
                          </p>
                          <p class="ft_weight_400 line_h_26">
                            当前申请(专利权)人：{{ item.aspo }}
                          </p>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </section>
        </div>
      </div>
    </div>
    <Footer />
    <signUp
      :dialogVisible="dialogVisible"
      @handleClose="handleClose"
      @submit="submit"
      :text="text"
    />
    <rightMenu @moveTo="moveTo" />
  </div>
</template>

<script>
import Header_h from "@/components/Header_h";
import Footer from "@/components/Footer";
import bannerInfo from "@/components/web/bannerInfo";
import leftMenu from "@/components/web/leftMenu";
import { teamInfo, consultAdd, getByTeamId } from "@/api/web";
import { getLabel } from "@/api/adminWeb";
import signUp from "@/components/web/signUp";
import rightMenu from "@/components/web/rightMenu";
import { PAGE_BASE_URL } from "@/config";

export default {
  components: {
    Header_h,
    Footer,
    bannerInfo,
    leftMenu,
    signUp,
    rightMenu,
  },
  data() {
    return {
      info: {
        title: "优秀专利汇总",
        content: "优秀团队及领头人",
        img: require("@/assets/web/banner1.png"),
      },
      check: -1,
      active: 2,
      menu: [
        {
          name: "详细简介",
        },
        {
          name: "科研项目",
        },
        {
          name: "优秀专利",
        },
      ],
      options: [],
      value: "",
      list: [],
      list: [],
      dialogVisible: false,
      text: {
        title: "咨询",
        btn: "立即咨询",
      },
      patent_list: [],
    };
  },
  mounted() {
    this.getList();
    this.getLabels();
    this.getByTeamIds();
  },
  methods: {
    clearValue() {
      this.getList();
    },
    moveTo() {
      window.scrollTo(0, 0);
    },
    handelChange() {
      this.getByTeamIds();
    },
    async getLabels() {
      this.options = await getLabel({ type: 1 });
    },
    checkItem(index) {
      this.active = index;
      this.showDetails();
    },
    async getByTeamIds() {
      this.patent_list = await getByTeamId({
        team_id: this.$route.query.id,
        realm_id: this.value,
      });
    },
    async getList() {
      try {
        this.list = await teamInfo({
          excellent_team_id: this.$route.query.id,
        });
      } catch (error) {
        this.$message.error(error.message);
      }
    },
    async handleClose() {
      this.dialogVisible = false;
    },
    async submit(form) {
      try {
        await consultAdd({
          ...form,
          from: this.url,
        });
        this.$message.success("提交成功");
      } catch (error) {
        this.$message.error(error.message);
      }
      this.dialogVisible = false;
    },
    getUrl(item) {
      this.url = `${PAGE_BASE_URL}/#/web/leader/details?id=${item.id}`;
      this.dialogVisible = true;
    },
    showDetails() {
      var el = document.getElementsByClassName(`listshow${this.active + 1}`)[0];
      // console.log(el.offsetTop);
      this.$nextTick(function () {
        window.scrollTo({ behavior: "smooth", top: el.offsetTop });
      });
    },
  },
};
</script>

<style lang="less" scoped>
.new_box {
  margin-top: -4%;
  position: relative;
  z-index: 1;
  margin-bottom: 60px;
}
.core_content .h_item_list_img {
  width: 144px;
  height: 144px;
  -o-object-fit: contain;
  object-fit: contain;
  overflow: hidden;
  background: #f6f6f6;
  text-align: center;
  .h_img_wap {
    padding-bottom: 0;
    width: 100%;
    height: 100%;
    // position: relative;
    img {
      width: 100%;
      height: 100%;
      -webkit-transition: all 0.5s ease;
      transition: all 0.5s ease;
      padding: 15px;
      -o-object-fit: contain;
      object-fit: contain;
    }
  }
}

.li_active {
  width: 100%;
  background: #ffffff;
  box-shadow: 0 0 16px rgba(24, 76, 171, 0.16);
  border: none;
}

.right_info {
  width: 70%;
  margin-left: 25px;
}

.core_content .item_list {
  padding: 23px 30px;
  width: 100%;
  margin-bottom: 30px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.content_spacing {
  margin: 22px auto 25px;
}
.core_content_left {
  width: 90%;
  margin-left: 60px;
  background-color: #fff;
  height: 100%;
  box-shadow: 0px 0px 21px 0px rgba(97, 97, 102, 0.23);
  padding: 30px 0;
  // margin-bottom:25px;
}
.core_content_right {
  width: 25%;
  background-color: #fff;
}
.content_right_spacing {
  margin: 10px 0;
}
.list_right {
  border-top: 1px solid #eee;
  padding: 10px 0;
  margin: 0 10px;
}
.right_title {
  margin: 0 10px;
  padding: 10px 0;
}

.sq_h3 {
  margin-bottom: 30px;
}

.sq_html {
  border-top: 1px solid var(--color9);
  // border-bottom: 1px solid var(--color9);
  padding: 30px 0;
  margin-top: 25px;
  /deep/ img {
    width: 100%;
    // margin: 30px 0;
  }
}

.new_footer {
  margin-top: 45px;
  div:hover {
    color: var(--color);
    cursor: pointer;
  }
  .iconfont {
    font-size: 12px;
  }
}
.new_box {
  margin-top: -4%;
  position: relative;
  z-index: 1;
  margin-bottom: 60px;
}
.core_content .item_list_img {
  width: 144px;
  height: 144px;
  object-fit: contain;
  overflow: hidden;
  background: #f6f6f6;
  text-align: center;
  .img_wap {
    padding-bottom: 0;
    width: 100%;
    height: 100%;
    // position: relative;
    img {
      width: 100%;
      transition: all 0.5s ease;
      padding: 15px;
      object-fit: contain;
      &:hover {
        transform: scale(1.1);
      }
    }
  }
}

.li_active {
  width: 100%;
  background: #ffffff;
  box-shadow: 0 0 16px rgba(24, 76, 171, 0.16);
  border: none;
}

.right_info {
  width: 82%;
  // margin-left: 25px;
}

.core_content .item_list {
  padding: 23px 30px;
  width: 95%;
  margin: 0 auto;
  // margin-bottom: 30px;
  background: #ffffff;
  // border: 1px solid #ced4ea;
  // border-bottom: 1px solid var(--color9);
  cursor: pointer;
  transition: all 0.2s ease;
  &:last-child {
    border-bottom: 0;
  }
  // &:hover {
  //   background: #f7f9fc;
  // }
}

.core_content .item_list:last-child {
  margin-bottom: 0;
}

.content_spacing {
  margin: 10px auto;
}
.core_content_left {
  width: 80%;
  margin-left: 250px;
  background-color: #fff;
  height: 100%;
  box-shadow: 0 0 16px rgba(24, 76, 171, 0.16);
}
.core_content_right {
  width: 25%;
  background-color: #fff;
}
.content_right_spacing {
  margin: 10px 0;
}
.list_right {
  // border-top: 1px solid #eee;
  padding: 10px 0;
  margin: 0 10px;
}
.right_title {
  margin: 0 10px;
  padding: 10px 0;
}
.tag_right {
  margin-right: 15px;
}
.pantent {
  margin-top: 10px;
  p {
    margin-right: 20px;
  }
}

.number {
  margin-bottom: 10px;
  .cril {
    width: 13px;
    height: 13px;
    background: #3377ff;
    border-radius: 50%;
    display: inline-block;
  }
}
.select_box {
  padding: 30px;
  .select_item {
    margin-right: 45px;
  }
}
.leader_box {
  margin-top: 20px;
  p {
    margin-bottom: 10px;
  }
}
.leader_infos {
  margin-top: 50px;
  .r_line {
    width: 5px;
    height: 16px;
    line-height: 30px;
    background: #ca0010;
    box-shadow: 1px 2px 4px 0px rgba(251, 79, 79, 0.35);
    display: inline-block;
    vertical-align: middle;
    margin-right: 5px;
  }
}
.core_content .item_list {
  padding: 23px 30px;
  width: 100%;
  // margin: 0 auto 30px;
  // margin-bottom: 30px;
  background: #ffffff;
  // border: 1px solid #ced4ea;
  cursor: pointer;
  transition: all 0.2s ease;
  &:hover {
    background: #f7f9fc;
  }
}

.core_content .item_list:last-child {
  margin-bottom: 0;
}

.list_right {
  // border-top: 1px solid #eee;
  padding: 10px 0;
  margin: 0 10px;
}
.right_title {
  margin: 0 10px;
  padding: 10px 0;
}
.tag_right {
  margin-right: 20px;
}
.pantent {
  margin-top: 10px;
  p {
    margin-right: 20px;
  }
}

.number {
  margin-bottom: 10px;
  .cril {
    width: 13px;
    height: 13px;
    background: #3377ff;
    border-radius: 50%;
    display: inline-block;
  }
}
.select_box {
  padding: 30px;
  .select_item {
    margin-right: 45px;
  }
}

.core_content .item_list_img {
  width: 188px;
  height: 237px;
  object-fit: contain;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid #e6e9f0;
  border-radius: 5px;
  text-align: center;
  .img_wap {
    padding-bottom: 0;
    width: 100%;
    height: 100%;
    // position: relative;
    img {
      width: 100%;
      transition: all 0.5s ease;
      padding: 15px;
      object-fit: contain;
      &:hover {
        transform: scale(1.1);
      }
    }
  }
}

.leader_heads {
  padding: 0 30px;
}

@media (max-width: 750px) {
  .leader_heads {
    padding: 30px 15px 0;
  }
  .core_content .h_item_list_img {
    width: 100%;
    // height: 80px;
    margin-bottom: 10px;
  }
  .core_content .h_item_list_img .h_img_wap img {
    padding: 0;
  }
  .right_info {
    margin-left: 0;
  }
  .leader_box {
    margin-top: 10px;
  }
  .leader_infos {
    margin-top: 0;
  }
  .core_content .item_list {
    padding: 23px 15px;
    width: 100%;
  }
  .core_content .item_list_img {
    width: 100%;
    margin-bottom: 10px;
  }
  .tag_right {
    margin-right: 10px;
  }
  .select_box {
    padding: 15px;
  }
  .select_box .select_item {
    margin-right: 10px;
  }
  .right_info {
    width: 100%;
    .sq_sign_btn {
      margin: 20px 0;
    }
  }
}
</style>